import 'package:json_annotation/json_annotation.dart';
part 'login_model.g.dart';

@JsonSerializable()
class LoginResult {
  final bool success;
  final String message;
  final String token;
  final UserInfo data;

  const LoginResult(
    this.success,
    this.message,
    this.token,
    this.data,
  );

  factory LoginResult.fromJson(Map json) => _$LoginResultFromJson(json);
  Map toJson() => _$LoginResultToJson(this);
}

@JsonSerializable()
class UserInfo {
  final String aid;
  final String name;
  final String code;
  final String mobile;
  final String roleName;
  final String avatarUrl;

  UserInfo(
    this.aid,
    this.name,
    this.code,
    this.mobile,
    this.roleName,
    this.avatarUrl,
  );

  factory UserInfo.fromJson(Map json) => _$UserInfoFromJson(json);
  Map toJson() => _$UserInfoToJson(this);
}
